import React, {Component} from 'react';
import ShowItem from "./ShowItem";
import './index.less'
import {withRouter} from "react-router-dom";

class ShowList extends Component {
    title = () => {
        const sideid = this.props.arr[0]?.gsideid
        let title = ''
        switch (sideid) {
            case 1:
                title = 'Apple部分产品'
                break;
            case 2:
                title = 'Huawei部分产品'
                break;
            case 3:
                title = 'Mi部分产品'
                break;
            default:
                title = '热门推荐'
        }
        return title
    }
    render() {
        return (
            <div className='showLine'>
                <div className='title'>{this.title()}</div>
                <div className='showList'>
                    {
                        this.props.arr.map(item => {
                            return (
                                <ShowItem key={item.gid} data={item}/>
                            )
                        })
                    }
                </div>
            </div>

        );
    }
}

export default withRouter(ShowList);